feat: add holiday mode support (get/set/cancel)#149
Open
nsleigh wants to merge 6 commits into
Open
Conversation
Adds get_holiday_mode/set_holiday_mode/cancel_holiday_mode to the async and sync API layers and a HiveHub wrapper accepting datetime start/end. Payload shape (GET/POST/DELETE on /holiday-mode, epoch-ms start/end + temperature) was confirmed via a HAR capture of Hive's own website, since this endpoint was previously unimplemented. Includes the diagnostic scripts used to reverse-engineer it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Exercises HiveHub.get_holiday_mode/set_holiday_mode/cancel_holiday_mode against a real Hive account: schedules a 7-day window starting in an hour (verified via GET readback, then cancelled before it can go active), and a second window starting an hour in the past to check whether the backend rejects it (it doesn't -- only the app's UI enforces that, not the API). Prints both UTC and local time so results are directly comparable against the Hive app/website. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Not intended to be committed to the repo -- kept locally only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Not intended to be committed to the repo -- kept locally only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #149 +/- ##
=======================================
Coverage 99.96% 99.96%
=======================================
Files 30 30
Lines 2508 2563 +55
Branches 292 296 +4
=======================================
+ Hits 2507 2562 +55
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
|
@nsleigh please can you fix the linting errors please |
Two dict literals in test_hub.py exceeded ruff format's line-wrap threshold, failing the Lint CI check (ruff check itself was clean, since E501 is ignored, but ruff format still wants the wrap).
Author
Author
Contributor
|
@nsleigh there is just the 2 pylint ones `
************* Module tests.unit.test_hive_api |
- test_hive_api.py: drop unused url_arg from tuple-unpack, index the two needed values individually (matches existing pattern elsewhere in this file) — fixes W0612 unused-variable - test_hive_async_api.py: remove redundant local 'import json', module already imports it at the top — fixes W0404 reimported
Author
|
I am hoping they are ok now - relying too much on AI! |
Author
|
@KJonline all fixed on my side. The new failure is due to the workflow not working on a branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_holiday_mode()/set_holiday_mode()/cancel_holiday_mode()to both the async (HiveApiAsync) and sync (HiveApi) API layers, plus aHiveHubconvenience wrapper (set_holiday_modetakesdatetimestart/end and converts to epoch-ms internally)./holiday-modeendpoint was previously unimplemented in this library (only the URL constant existed, going back to 2021) — the request/response shape (GET/POST/DELETE, epoch-millisecondstart/end,temperature) was confirmed from a HAR capture of Hive's own website, then verified end-to-end against a real account.HiveApi.request()to supportDELETE(previously onlyGET/POST), needed forcancel_holiday_mode().MALFORMED_REQUEST). Root cause turned out to be thatautoBoostis not a client-writable field — it appears to be a server-side side effect of Holiday Mode, which is why this PR adds real Holiday Mode support instead of patching that field directly.starttime (confirmed live) — that's only enforced client-side by the Hive app/website UI, not the API. Leftset_holiday_modeas a thin wrapper matching the real API contract rather than adding client-side validation.Test plan
get_holiday_mode/set_holiday_mode/cancel_holiday_modein bothtests/unit/test_hive_async_api.pyandtests/unit/test_hive_api.pyHiveHubwrapper intests/module/test_hub.pyGET /holiday-modereadback that start/end matched, then cancelled and confirmed cancellation; also confirmed a past-start-time request is accepted by the API (not rejected)🤖 Generated with Claude Code